Ext.define('Admin.view.system.template.Template', {
	extend: 'Admin.ux.PageGrid',
    xtype: 'template-view',
    title: '消息模版',
    viewModel: {
       stores: { 
	        data: {
	            type: 'template-store',
	            autoLoad: true
	   		 }
	    },
	    data:{
	    	batchRemoveAction : true,
	    	batchRemoveText:'批量删除(0)'
	  }
    },
    
    controller:'template',
    listeners: {
        selectionchange: 'onSelectionChange'
    },
	columnLines : false,
 	columns: [
	 	{ xtype: 'rownumberer',width:70,text:'行号'},
	 	{ xtype:'hidden', text: '消息id', dataIndex: 'tpl_id'}, 
		{ xtype:'gridcolumnview', width:"70%",text: '模版内容', dataIndex: 'tpl_content'}, 
	 	{ text: '状态', dataIndex: 'check_status',renderer:function(value, meta, record){
	 		if(value=="CHECKING"){
	 			return "<font color='#CC9900' data-qtip='审核中'>审核中</font>";
	 		}else if(value=="SUCCESS"){
	 			return  "<font color='#339933'  data-qtip='审核成功'>审核成功</font>";
	 		}else{
	 			meta.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(record.get('reason')) + '"';
	 			return  "<font color='#FF6600'>审核失败</font>";
	 		}
	 	}}, 
	    {
	        menuDisabled: true,
	        sortable: false,
	        xtype: 'actioncolumn',
	        width: 100,
	        text:'操作',
	        items: [
					{
					    iconCls: 'array-grid-buy-col',
					    tooltip: '编辑',
					    handler:'editAction'
					},
					 '-',
			        {
			             iconCls: 'array-grid-sell-col',
			             tooltip: '删除',
			             handler: 'removeAction'
			        }
			]
	    }
	],
	
    tbar:[
		{
			text:'新建模板',
			iconCls: 'x-fa fa-plus',
			handler:'addAction'
		},
		{
    		iconCls: 'x-fa fa-minus',
	    	handler:'batchRemoveAction',
	    	bind:{
    			disabled :'{batchRemoveAction}',
    			text:'{batchRemoveText}'
    		}
    	}
	]
});
